<?php
class Pageley_Util_PathManager {
    
    private static $instance;
    
    private $rootPath = "./";
    private $contextPath = "/";
    private $paths;
	
    private function __construct() {
        $this->paths = new Pageley_Util_ArrayMap();
    }
    
	public static function getInstance() {
		if(self::$instance === null) {
			self::$instance = new Pageley_Util_FileManager();
		}
		return self::$instance;
	}
    
    public function setPaths($paths) {
        $this->paths = $paths;
    }
    
    public function setRootPath($rootPath) {
        $this->rootPath = $rootPath;
    }
    
    public function setContextPath($contextPath) {
        $this->contextPath = $contextPath;
    }
    
    public function getFilePath($pathName) {
        $path = $this->paths->get($pathName);
        return $this->rootPath . $path;
    }

    public function getContextPath($pathName) {
        $path = $this->paths->get($pathName);
        return $this->contextPath . $path;
    }
}